<template>
  <div v-if="Object.keys(commentInfo).length !== 0" class="comment-info">
    <div class="info-header">
      <div class="header-title left">用户评价</div>
      <div class="header-more right">
        更多
        <i class="arrow-right"></i>
      </div>
    </div>

    <div class="info-user">
      <img v-lazy="commentInfo.user.avatar" alt="" />
      <span>{{ commentInfo.user.uname }}</span>
    </div>
    <div class="info-detail">
      <p>{{ commentInfo.content }}</p>
      <div class="info-other">
        <span class="date">{{ commentInfo.created | timeFormater }}</span>
        <span>{{ commentInfo.style }}</span>
      </div>
    </div>
    <div class="info-imgs">
      <img
        v-for="(item, index) in commentInfo.images"
        v-lazy="item"
        :key="index"
        alt=""
      />
    </div>
  </div>
</template>

<script>
import dayjs from "dayjs";
export default {
  name: "DetailCommentInfo",
  props: {
    commentInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  filters: {
    timeFormater(value, str = "YYYY年MM月DD日 HH:mm:ss") {
      console.log("@", value);
      const data = new Date(value * 1000);
      return dayjs(data).format(str);
    },
  },
  mounted() {},

  methods: {},
};
</script>

<style lang="less" scoped>
.comment-info {
  padding: 5px 12px;

  color: #333;
  border-bottom: 5px solid #f2f5f8;
  & > div {
    margin-top: 10px;
  }
}
.info-header {
  height: 50px;
  line-height: 50px;
  border-bottom: 1px solid rgba(0, 0, 0);
}
.arrow-right {
}
.info-user {
  padding: 10px 0 5px;

  img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
  }
  span {
    font-size: 15px;

    margin-left: 10px;
  }
}
.info-detail {
  padding: 0 5px 15px;

  p {
    font-size: 14px;
    color: #777;
    line-height: 1.5;
  }

  .info-other {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
  }

  .date {
    margin-right: 8px;
  }
}

.info-imgs img {
  width: 70px;
  height: 70px;
  margin-right: 5px;
}
</style>
